package svc

import (
	"github.com/zeromicro/go-zero/core/stores/postgres"
	"go-zero-demo-04/mall/quiz/api/QuizModel"
	"go-zero-demo-04/mall/quiz/api/internal/config"
)

type ServiceContext struct {
	Config    config.Config
	QuizModel QuizModel.MbtiTestModel
}

func NewServiceContext(c config.Config) *ServiceContext {
	conn := postgres.New(c.DB.DataSource)
	return &ServiceContext{
		Config:    c,
		QuizModel: QuizModel.NewMbtiTestModel(conn, c.Cache),
	}
}
